#ifndef BROWSER_H
#define BROWSER_H

#include "include.h"

class ArbreBdd;
class HistoriqueRequetes;

class Browser: public QMainWindow
{
    Q_OBJECT

public:
    Browser(QWidget *parent = 0);

    QSqlError addConnection(QString driver, QString dbName, QString host, QString user, QString passwd, int port = -1);

    QVBoxLayout* vbGroup;
    QMenu* fileMenu;
    QSplitter* splitterDb;
    ArbreBdd* connectionWidget;
    HistoriqueRequetes* historique;
    QTableView* table;
    QGroupBox* groupBox;
    QTextEdit* sqlEdit;
    QHBoxLayout* hbButton;
    QSplitter* splitterRequete;
    QSplitter* splitterPrincipal;
    QSpacerItem* spacerItem;
    QPushButton* clearButton;
    QPushButton* submitButton;
    QStatusBar* statusB;

    void setupUi();

public slots:
    void exec();
    void addConnection();

    void on_submitButton_clicked()
    {
        exec();
        sqlEdit->setFocus();
    }

    void on_clearButton_clicked()
    {
        sqlEdit->clear();
        sqlEdit->setFocus();
    }

signals:
    void statusMessage(const QString &message);
};

#endif
